package org.biloxi.game.gamerules.playerlost;

import org.biloxi.commands.CommandRepository;
import org.biloxi.commands.playerlost.PlayerLost;
import org.biloxi.model.GameState;
import org.biloxi.player.PlayerID;

/**
 * Convience base class for all Game Rules that determine whether a
 * player has lost or not.
 * 
 * @author Peter.WM.Wong@gmail.com
 *
 */
public abstract class PlayerLostRule {
	protected final CommandRepository _c; 
	public PlayerLostRule(CommandRepository cr) {
		_c = cr;		
	}
	
	/**
	 * Calls the {@link PlayerLost} Command.
	 * 
	 * @param loser
	 * @param g
	 */
	protected final void losePlayer(PlayerID loser,GameState g){
		_c.playerLost( new PlayerLost.Options(loser) );
	}
}
